package com.springcloud.eshop.product.rabbitmq;

import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

/**
 * @Desc:
 * @Date: 2020-06-29
 * @Version:v1.0
 */
@Repository
public class RabbitmqProducer {

    /**
     * 队列名称
     */
    private final static String QUEUE_NAME = "eshop-change-queue";

    /**
     * 队列名称
     */
    private final static String DATA_CHANGE_QUEUE_NAME = "data-change-queue";

    @Autowired
    private AmqpTemplate rabbitmq;

    public void sendTestMessage(String message) {
        rabbitmq.convertAndSend(QUEUE_NAME, message);
    }

    public void sendMessage(String message) {
        rabbitmq.convertAndSend(DATA_CHANGE_QUEUE_NAME, message);
    }
}
